Skip to content

fix: match Cache-Control no-transform directive case-insensitively - #286

Merged
UlisesGascon merged 3 commits into
expressjs:masterfrom
vaibhavmashal:fix/cache-control-no-transform-case-insensitive
Sep 9, 2026
Merged

fix: match Cache-Control no-transform directive case-insensitively#286
UlisesGascon merged 3 commits into
expressjs:masterfrom
vaibhavmashal:fix/cache-control-no-transform-case-insensitive

Conversation

@vaibhavmashal

Copy link
Copy Markdown
Contributor

Fixes #284

Per RFC 9111 Section 5.2, Cache-Control directives are compared case-insensitively. Previously, \compression\ checked for
o-transform\ case-sensitively, so headers like \Cache-Control: No-Transform\ or \Cache-Control: NO-TRANSFORM\ were not recognized and responses were still compressed.

Changes

  • Added the case-insensitive flag /i\ to \cacheControlNoTransformRegExp\ in \index.js.
  • Added unit tests in \ est/compression.js\ ensuring that different casings of
    o-transform\ prevent compression.

Copilot AI lite review requested due to automatic review settings August 31, 2026 16:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@UlisesGascon UlisesGascon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vaibhavmashal for helping the project! This change will land in the next release. I refactored a bit the tests and included a small reference on the HISTORY.md

@UlisesGascon
UlisesGascon merged commit 0a76495 into expressjs:master Sep 9, 2026
60 checks passed
@UlisesGascon UlisesGascon mentioned this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache-Control no-transform directive is matched case-sensitively

3 participants